<?php

class PayController extends Controller {
    public function actionIndex() {
        //показать все неоплаченные заказы

        $this->render('index');
    }
    
    
    public function actionPay($id) {


        $sharedsec = 'dfs845bg84hgf89dsbf943';

        $params = array();
        $params['product_id'] = '006654-0001-0001';
        $params['product_price'] = '0.01';
        $params['cs1'] = $id;
        $params['sign'] = md5("{$params[product_id]}-{$params[product_price]}-$sharedsec");

        $this->render('pay', $params);
    }

    public function actionCallback() {
        $id = $_POST['cs1'];
        //если нет такого id ?  - 404
        //id есть 
        //@todo logs // 
        $order = Order::model()->findByPk($id);
        $order->pay();
        $order->save();
    }

    public function actionSuccess() {
        //redirect
    }

    public function actionDecline() {
        //redirect 
    }

}
